import router from "@system.router";

export default {
    data: {
        title: "World",
        // 顶部栏
        username: "阿伟",
        num: 4,
        // 底部菜单栏
        menuData: [
            {
                imgSrc: "common/images_bottom_menu_bar/home.png",
                imgSrcActive: "common/images_bottom_menu_bar/home_active.png",
                title: "首页",
            },
            {
                imgSrc: "common/images_bottom_menu_bar/scenarios.png",
                imgSrcActive:
                "common/images_bottom_menu_bar/scenarios_active.png",
                title: "场景",
            },
            {
                imgSrc: "common/images_bottom_menu_bar/message.png",
                imgSrcActive:
                "common/images_bottom_menu_bar/message_active.png",
                title: "消息",
            },
            {
                imgSrc: "common/images_bottom_menu_bar/mine.png",
                imgSrcActive: "common/images_bottom_menu_bar/mine_active.png",
                title: "我的",
            },
        ],
        defaultIndex: 0,
        content: [
            {
                imgSrc: "common/home/u327.png",
                position: "室外",
                num: 4,
                temperature: 30,
                humidity: 49,
                luminance: 50,
            },
            {
                imgSrc: "common/home/u339.png",
                position: "主卧",
                num: 4,
                temperature: 30,
                humidity: 49,
                luminance: 50,
            },
            {
                imgSrc: "common/home/u310.png",
                position: "室外",
                num: 4,
                temperature: 30,
                humidity: 49,
                luminance: 50,
            },
        ],
    },

    bottomNavigationBarClick(num) {
        this.defaultIndex = num;

        if (0 == this.defaultIndex) {
            router.replace({
                uri: "pages/home/home",
            });
        }

        if (1 == this.defaultIndex) {
            router.replace({
                uri: "pages/scene/p1",
            });
        }

        if (2 == this.defaultIndex) {
            router.replace({
                uri: "pages/message/message",
            });
        }

        if (3 == this.defaultIndex) {
            router.replace({
                uri: "pages/personal/personal",
            });
        }


    },

    cut() {
        router.push({
            uri: "pages/add_device/add_device",
        });
    },

    cut_to_hall() {
        router.push({
            uri: "pages/home_hall/home_hall",
        });
    }
};
